package com.b.domain;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 观看历史表
 */
@Document(indexName = "watchhistory")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WatchHistory {
    /**
     * 主键
     */
    @Id
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer id;

    /**
     * 用户ID
     */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer userId;

    /**
     * 视频ID
     */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer videoId;

    /**
     * 观看时间
     */
    @Field(type = FieldType.Date, index = false , store = true)
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd hh:mm")
    private Date watchTime;

    /**
     * 播放进度（秒）
     */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer progress;

    private Video video;
}
